Not sure why we were doing this, it's quite useful!
Closes #1297
.version(Some(version()));
docopt.decode().map_err(|e| {
let code = if e.fatal() {1} else {0};
- let desc = match e {
- docopt::Error::WithProgramUsage(_, s) => s,
- ref e if e.fatal() => e.description().to_string(),
- e => e.to_string(),
- };
- CliError::from_error(human(desc), code)
+ CliError::from_error(human(e.to_string()), code)
})
}
assert_that(cargo_process("new"),
execs().with_status(1)
.with_stderr("\
+Invalid arguments.
+
Usage:
cargo new [options] <path>
cargo new -h | --help
assert_that(&paths::root().join("foo/components/subcomponent/.gitignore"),
is_not(existing_file()));
});
+
+test!(unknown_flags {
+ assert_that(cargo_process("new").arg("foo").arg("--flag"),
+ execs().with_status(1)
+ .with_stderr("\
+Unknown flag: '--flag'
+
+Usage:
+ cargo new [..]
+ cargo new [..]
+"));
+});